package com.op.teachingliteapp.sender.ui.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import com.polites.android.GestureImageView;

/**
 * Created by Genji on 2015/7/10.
 */
public abstract class BasicViewPager extends ViewPager {
    protected String TAG = this.getClass().getSimpleName();
    protected boolean isCanScroll = true;
    public BasicViewPager(Context context) {
        super(context);
    }

    public BasicViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }





    public void setCanScroll(boolean isCanScroll) {
        this.isCanScroll = isCanScroll;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (isCanScroll) {
            return super.onTouchEvent(ev);
        } else {
            return false;
        }

    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (isCanScroll) {
            return super.onInterceptTouchEvent(ev);
        } else {
            return false;
        }

    }
}
